package com.weetop.aklyscan.presenter;

import android.app.Activity;

import com.weetop.aklyscan.base.mvp.BaseModel;
import com.weetop.aklyscan.base.mvp.BaseObserver;
import com.weetop.aklyscan.base.mvp.BasePresenter;
import com.weetop.aklyscan.bean.SearchBean;
import com.weetop.aklyscan.bean.SearchItemBean;
import com.weetop.aklyscan.view.LocationSearchView;
import com.weetop.aklyscan.view.LoginView;

import java.util.List;

public class LocationSearchPresent extends BasePresenter<LocationSearchView> {

    public LocationSearchPresent(LocationSearchView baseView, Activity activity) {
        super(baseView, activity);
    }

    public void searchList(String key, String page) {
        addDisposable(apiServer.searchList(key, page), new BaseObserver<BaseModel<SearchBean>>(baseView) {
            @Override
            public void onSuccess(BaseModel<SearchBean> o) {
                baseView.getserailSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

    public void Into61(String key, String order_type, String ck_type) {
        addDisposable(apiServer.Into61(key, "1", "10000", order_type, ck_type), new BaseObserver<BaseModel<SearchBean>>(baseView) {
            @Override
            public void onSuccess(BaseModel<SearchBean> o) {
                baseView.getserailSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }


}
